<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
   
</head>
<body>
    <div id="mydiv"></div>
    <div id="mydiv2"></div>
    <script>
        var users={
            username:"alice",
            age:20,
            address:[
                {
                    id:1001,
                    addName:"第一故乡南京"
                },
                {
                    id:1002,
                    addName:"第二故乡上海"
                },
                {
                    id:1003,
                    addName:"第三故乡北京"
                }
            ]
        };

        let {username,age,address:[{addName:addName1},{addName:addName2},{addName:addName3}]}=users;
        let strs=`
            <div>我的名字叫：${username}</div>
            <div>我的年龄：${age}</div>
            <div>我的故乡分别是：${addName1} ${addName2} ${addName3}</div>
        `;
        document.getElementById("mydiv").innerHTML=strs;

        var objs=[
                {
                    username:"tom",
                    age:20,
                    hobby:"打游戏"
                },
                {
                    username:"lucy",
                    age:23,
                    hobby:"旅游"
                },
                {
                    username:"cici",
                    age:25,
                    hobby:"唱歌"
                }
            ];

        let [{username:username1,hobby:hobby1},,{username:username2,hobby:hobby2}]=objs;
        var strs2=`
            <div>姓名：${username1},爱好：${hobby1}</div>
            <div>姓名：${username2},爱好：${hobby2}</div>
        `;
        document.getElementById("mydiv2").innerHTML=strs2;
    </script>
</body>
</html>